package com.cenntro.common.mq.producer;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.StringUtils;

public class MQProducerCondition implements Condition{

	@Override
	public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
		String isOnOff = context.getEnvironment().getProperty("rocketmq.producer.isOnOff");
//		String groupname = context.getEnvironment().getProperty("rocketmq.producer.groupname"); 
		if(!StringUtils.isEmpty(isOnOff) && isOnOff.equalsIgnoreCase("on")){
			return true;
		}
		return false;
	}

}
